package com.fyk.controller;

import com.fyk.service.DepService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author 范宇坤
 * @date: 2021/8/4 17:36
 */
@Controller
@RequestMapping("dep")
public class DepController {

    private static final Logger log = LoggerFactory.getLogger(DepController.class);
    private DepService depService;
    @Autowired
    public void setDepService(DepService depService) {
        this.depService = depService;
    }

    @RequestMapping("getAllDepartment")
    public String getAllDepartment(Model model){
        List<String> depNames = depService.queryAllDepName();
        model.addAttribute("depNames",depNames);
        log.info("查询到的部门有:{}",depNames);
        return "empAdd";
    }

}
